//
// Created by xili on 2024/8/22 15:21.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    int maxVowels(string s, int k) {
        int ans = 0, r = 0, l = 0;
        int n = s.size();
        while (r < k) {
            ans += isYuan(s[r++]);
        }
        int cur = ans;
        while (r < n) {
            cur += isYuan(s[r++]) - isYuan(s[l++]);
            ans = max(ans, cur);
        }
        return ans;
    }

    bool isYuan(char c) {
        return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';
    }
};